Skip to content

nit: returning NULL with no explanation is not cool #18543

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

divinity76
Copy link
Contributor

No description provided.

Comment on lines +232 to +240
if (dbh->error_mode == PDO_ERRMODE_EXCEPTION) {
zend_throw_exception_ex(
php_pdo_get_exception(), 0,
"SQLite PDO::quote: string is too long to quote");
} else if (dbh->error_mode == PDO_ERRMODE_WARNING) {
php_error_docref(
NULL, E_WARNING,
"string is too long to quote");
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about using pdo_raise_impl_error() for SQLSTATE 22001?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, should it use 22001 regardless of error mode, or should it use 22001 for exception and 01004 otherwise?

Copy link
Member

@SakiTakamachi SakiTakamachi May 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since 01004 is a warning that occurs when read data is discarded for instance, when the buffer is too small, I believe that in every case, 22001 is the appropriate choice.

edit:
Since this distinction is made in systems like DB2 and ODBC, 01004 is generally considered to be related to fetch operations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants